/** Component: Search */
@use './mixins' as *;

:root body {
  --docsearch-hit-height: 56px;
  --docsearch-searchbox-height: 40px;
  --docsearch-spacing: var(--strapi-spacing-4);
}

body .DocSearch {
  --custom-search-hit-pb: var(--strapi-spacing-2);

  &-SearchBar {
    padding-bottom: var(--strapi-spacing-1);
  }

  &-Input {
    --docsearch-text-color: var(--strapi-neutral-800);
  }

  &-Input,
  &-Cancel {
    font-size: var(--strapi-font-size-md);
  }

  &-Hit {
    padding-bottom: var(--custom-search-hit-pb);
  }
}

/**
 * Styles for the DocSearch modal
 */
.docsearch-modal {
  --docsearch-primary-color: var(--strapi-primary-600);
  --docsearch-muted-color: rgb(150, 159, 175);
  --docsearch-modal-container-background: rgba(101, 108, 133, 0.8);
  --docsearch-searchbox-focus-background: #fff;
  --docsearch-searchbox-shadow: inset 0 0 0 2px var(--docsearch-primary-color);
  --docsearch-hit-color: rgb(68, 73, 80);
  --docsearch-hit-active-color: #fff;
  --docsearch-hit-background: #fff;
  --docsearch-hit-shadow: 0 1px 3px 0 rgb(212, 217, 225);
}

.docsearch-modal-search-hits-item {
  border-radius: 8px;
  &:hover,
  &[aria-selected="true"] {
    background-color: var(--strapi-primary-600);

    .docsearch-modal-search-hits-item-text-container {
      p {
        color: var(--strapi-neutral-100);
      }
    }

    mark {
      background-color: var(--strapi-primary-600) !important;
      color: white;
    }
  }

  mark {
    background-color: transparent !important;
  }
}

.docsearch-modal-search-input {
  color: var(--strapi-neutral-800)
}

@include dark {
  .docsearch-modal {
    --docsearch-text-color: rgb(245, 246, 247);
    --docsearch-modal-container-background: rgba(9, 10, 17, 0.8);
    --docsearch-modal-background: rgb(21, 23, 42);
    --docsearch-modal-shadow: inset 1px 1px 0 0 rgb(44, 46, 64), 0 3px 8px 0 rgb(0, 3, 9);
    --docsearch-searchbox-background: rgb(9, 10, 17);
    --docsearch-searchbox-focus-background: #000;
    --docsearch-hit-color: rgb(190, 195, 201);
    --docsearch-hit-shadow: none;
    --docsearch-hit-background: rgb(9, 10, 17);
    --docsearch-key-gradient:
      linear-gradient(
        -26.5deg,
        rgb(86, 88, 114) 0%,
        rgb(49, 53, 91) 100% );
    --docsearch-key-shadow:
      inset 0 -2px 0 0 rgb(40, 45, 85),
      inset 0 0 1px 1px rgb(81, 87, 125),
      0 2px 2px 0 rgba(3, 4, 9, 0.3);
    --docsearch-footer-background: rgb(30, 33, 54);
    --docsearch-footer-shadow: inset 0 1px 0 0 rgba(73, 76, 106, 0.5), 0 -4px 8px 0 rgba(0, 0, 0, 0.2);
    --docsearch-muted-color: rgb(127, 132, 151);
    --docsearch-icon-color: rgb(255, 255, 255);
  }
  .docsearch-modal-search-hits-item mark {
    background-color: var(--strapi-neutral-100) !important;
    color: var(--strapi-neutral-700);
  }
  .docsearch-modal-search-hits-item:hover,
  .docsearch-modal-search-hits-item[aria-selected="true"],
  .docsearch-modal-search-hits-item--active .docsearch-modal-search-hits-item-text-container p {
    color: white !important;
    mark {
      background-color: var(--strapi-primary-600) !important;
      color: var(--strapi-neutral-700);
    }
  }
}